﻿Imports BUS
Public Class frmxlcapnhatloaisach

    Private _maloaisach As Integer
    Public Property MaloaiSach() As Integer
        Get
            Return _maloaisach
        End Get
        Set(ByVal value As Integer)
            _maloaisach = value
        End Set
    End Property

    Private Sub frmxlcapnhatloaisach_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub SimpleButton_DongY_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton_DongY.Click
        If TextEdit_TenLoaiSach.Text <> "" Then
            Dim sql As String = "Update THELOAISACH Set TenTheLoai=" + "'" + TextEdit_TenLoaiSach.Text + "'" + " Where MaTheLoai=" + _maloaisach.ToString()
            Dim bus As New LoaiSachBUS()
            Dim kq As Integer = bus.CapNhatLoaiSach(sql)
            If kq = 1 Then
                MessageBox.Show("Câp nhật thành công !")
                Me.Close()
            Else
                MessageBox.Show("Cập nhật thất bại !")
            End If
        Else
            MessageBox.Show("Nhập tên Loại Sách !")
        End If
    End Sub

    Private Sub SimpleButton_Thoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton_Thoat.Click
        Close()
    End Sub
End Class